package game.web.struts;

import game.web.base.Constants;
import game.web.base.User;
import game.web.dao.dto.TicketDTO;
import game.web.viewhelper.TicketViewHelper;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import projectx.web.base.ConstantsProjectX;
import projectx.web.base.ProjectXNoCheckPermissionAction;
import projectx.web.base.navi.Function;

public class LoginInitAction extends ProjectXNoCheckPermissionAction {

	@Override
	protected ActionForward execute(User user, Function function,
			ActionMapping mapping, ActionForm form, HttpServletRequest request,
			HttpSession session, HttpServletResponse response) throws Exception {
		return findForward(mapping, forwardSuccess);
	}

	@Override
	protected boolean isPostMethodOnly() {
		return false;
	}

	private void initViewHelper(HttpServletRequest request) {

		TicketViewHelper viewHelper = new TicketViewHelper();
		TicketDTO dto = (TicketDTO) getUcAttribute(Constants.TICKET_SEARCH_ACION);

		viewHelper.setSeqid(dto.getSeqid());
		viewHelper.setCreatedate(dto.getCreatedate());
		viewHelper.setUpdateby(dto.getUpdateby());
		viewHelper.setLastupdate(dto.getLastupdate());

		request.setAttribute(ConstantsProjectX.VIEW_HELPER, viewHelper);
	}

}
